package com.haiya.identityaccess.domain.identity.repository;

import com.haiya.identityaccess.domain.identity.model.TenantId;
import com.haiya.identityaccess.domain.identity.model.User;

import java.util.Collection;

/**
 * @author qiaoguoqiang
 */
public interface UserRepository {

    /**
     * 添加用户
     * @param aUser
     */
    public void add(User aUser);

    /**
     * 查找所有类似名字的用户
     * @param aTenantId
     * @param aFirstNamePrefix
     * @param aLastNamePrefix
     * @return
     */
    public Collection<User> allSimilarlyNamedUsers(
            TenantId aTenantId,
            String aFirstNamePrefix,
            String aLastNamePrefix);

    /**
     * 删除用户
     * @param aUser
     */
    public void remove(User aUser);

    public User userFromAuthenticCredentials(
            TenantId aTenantId,
            String aUsername,
            String anEncryptedPassword);

    /**
     * 查找给定名字的用户
     * @param aTenantId
     * @param aUsername
     * @return
     */
    public User userWithUsername(
            TenantId aTenantId,
            String aUsername);
}
